#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	int m, n;
	scanf("%d%d", &m, &n);
	int m1 = m;
	int n1 = n;
	if (m < 1 || n < 1)
	{
		printf("-1");
		return 0;
	}

	while (m % n != 0)
	{
		int temp = n;
		n = m % n;
		m = temp;
	}
	printf("%d ", n);
	printf("%d", (m1 * n1) / n);
	return 0;
}